﻿using System;

namespace Sencha.Serialization.Serializers
{
	public sealed class GuidSerializer : TypeSerializer<Guid>
	{
		public override Guid Deserialize(IJsonReader reader)
		{
			var guidStr = reader.ReadString(false);
			var value = new Guid(guidStr);
			return value;
		}
		public override void Serialize(IJsonWriter writer, Guid value)
		{
			var guidStr = value.ToString();
			writer.Write(guidStr);
		}
	}
}
